package com.tongcao.cn.contoller;

import com.tongcao.cn.annotation.MethodMeasureAnnotation;
import com.tongcao.cn.dfire.result.ResultMap;
import com.tongcao.cn.dfire.utils.ApiResultUtil;
import com.tongcao.cn.processor.ProcessDispatcher;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author:tongcao
 * @Date:2018/12/28 17:19
 * Description:
 */
@RestController
@RequestMapping("/route")

public class DispatcherController {


    @Resource
    ProcessDispatcher dispatcher;


    /**
     * 路由分发
     *
     * @return
     */
    @GetMapping("/test")
    @MethodMeasureAnnotation
    public ResultMap route(String url) {
        String result = dispatcher.route(url);
        return ApiResultUtil.successResult(result);
    }
}
